<template>
	<view>
		<cu-custom bgImage="https://image.weilanwl.com/color2.0/plugin/cjkz2329.jpg"><block slot="content">登录模板</block></cu-custom>
		<view class="padding flex flex-direction">
			<button class="cu-btn bg-gradual-blue lg shadow" @tap="login">登录</button>
			<button class="cu-btn bg-gradual-green margin-top-lg shadow" @tap="sanCode">扫码</button>
		</view>
	</view>
</template>

<script>
export default {
	methods: {
		sanCode() {
			uni.scanCode({
				success: function(res) {
					if (res.scanType == 'QR_CODE') {
						// 普通二维码
						uni.navigateTo({
							url: '/' + res.result
						});
					} else if (res.scanType == 'WX_CODE') {
						// 小程序二维码
						uni.navigateTo({
							url: '/' + res.path
						});
					}
				}
			});
		},
		login() {
			uni.navigateTo({
				url: '/pages/login/login'
			});
		}
	}
};
</script>

<style>
</style>
